package cloud.daodao.storm.common.user.api;

import cloud.daodao.storm.common.constant.AppConstant;
import cloud.daodao.storm.common.model.PageData;
import cloud.daodao.storm.common.model.PageParam;
import cloud.daodao.storm.common.model.Request;
import cloud.daodao.storm.common.model.Response;
import cloud.daodao.storm.common.user.constant.UserConstant;
import cloud.daodao.storm.common.user.model.permission.PermissionData;
import cloud.daodao.storm.common.user.model.permission.PermissionSearch;
import cloud.daodao.storm.common.user.model.permission.PermissionSelect;
import cloud.daodao.storm.common.user.model.permission.PermissionUpsert;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;

/**
 * @author DaoDao
 */
@Tag(name = "PermissionApi", description = "用户服务 权限")
@HttpExchange(url = AppConstant.API)
public interface PermissionApi {

    @Operation(summary = "权限查询", description = "@DaoDao 传入权限 ID，查询一条权限数据")
    @PostExchange(url = UserConstant.PERMISSION_SELECT)
    Response<PermissionData> permissionSelect(@RequestBody @Valid Request<PermissionSelect> request);

    @Operation(summary = "权限写入", description = "@DaoDao 传入权限新增或修改参数 ，写入权限数据")
    @PostExchange(url = UserConstant.PERMISSION_UPSERT)
    Response<PermissionData> permissionUpsert(@RequestBody @Valid Request<PermissionUpsert> request);

    @Operation(summary = "权限搜索", description = "@DaoDao 传入权限查询参数，查询分页权限数据")
    @PostExchange(url = UserConstant.PERMISSION_SEARCH)
    Response<PageData<PermissionData>> permissionSearch(@RequestBody @Valid Request<PageParam<PermissionSearch>> request);

}
